package CoreNRMSystem;

/**
 * Generated from IDL union "SignallingInfoOfFarEndType".
 *
 * @author JacORB IDL compiler V 2.3.0, 17-Feb-2007
 * @version generated at 2013-5-20 22:07:19
 */

public final class SignallingInfoOfFarEndTypeHelper
{
	private static org.omg.CORBA.TypeCode _type;
	public static void insert (final org.omg.CORBA.Any any, final CoreNRMSystem.SignallingInfoOfFarEndType s)
	{
		any.type(type());
		write( any.create_output_stream(),s);
	}

	public static CoreNRMSystem.SignallingInfoOfFarEndType extract (final org.omg.CORBA.Any any)
	{
		return read(any.create_input_stream());
	}

	public static String id()
	{
		return "IDL:CoreNRMSystem/SignallingInfoOfFarEndType:1.0";
	}
	public static SignallingInfoOfFarEndType read (org.omg.CORBA.portable.InputStream in)
	{
		SignallingInfoOfFarEndType result = new SignallingInfoOfFarEndType ();
		CoreNRMSystem.PositionType disc = CoreNRMSystem.PositionType.from_int(in.read_long());
		switch (disc.value ())
		{
			case CoreNRMSystem.PositionType._SameManagedSystem:
			{
				StnNetworkResourcesNRMSystem.SignallingInfoType _var;
				_var=StnNetworkResourcesNRMSystem.SignallingInfoTypeHelper.read(in);
				result.signallingInfo1 (_var);
				break;
			}
			case CoreNRMSystem.PositionType._DiffManagedSystem:
			{
				java.lang.String _var;
				_var=in.read_string();
				result.signallingInfo2 (_var);
				break;
			}
		}
		return result;
	}
	public static void write (org.omg.CORBA.portable.OutputStream out, SignallingInfoOfFarEndType s)
	{
		out.write_long (s.discriminator().value ());
		switch (s.discriminator().value ())
		{
			case CoreNRMSystem.PositionType._SameManagedSystem:
			{
				StnNetworkResourcesNRMSystem.SignallingInfoTypeHelper.write(out,s.signallingInfo1 ());
				break;
			}
			case CoreNRMSystem.PositionType._DiffManagedSystem:
			{
				out.write_string(s.signallingInfo2 ());
				break;
			}
		}
	}
	public static org.omg.CORBA.TypeCode type ()
	{
		if (_type == null)
		{
			org.omg.CORBA.UnionMember[] members = new org.omg.CORBA.UnionMember[2];
			org.omg.CORBA.Any label_any;
			label_any = org.omg.CORBA.ORB.init().create_any ();
			CoreNRMSystem.PositionTypeHelper.insert(label_any, CoreNRMSystem.PositionType.SameManagedSystem);
			members[0] = new org.omg.CORBA.UnionMember ("signallingInfo1", label_any, StnNetworkResourcesNRMSystem.SignallingInfoTypeHelper.type(),null);
			label_any = org.omg.CORBA.ORB.init().create_any ();
			CoreNRMSystem.PositionTypeHelper.insert(label_any, CoreNRMSystem.PositionType.DiffManagedSystem);
			members[1] = new org.omg.CORBA.UnionMember ("signallingInfo2", label_any, GenericNRMSystem.DNHelper.type(),null);
			 _type = org.omg.CORBA.ORB.init().create_union_tc(id(),"SignallingInfoOfFarEndType",CoreNRMSystem.PositionTypeHelper.type(), members);
		}
		return _type;
	}
}
